﻿@model LAPI.Data.Model.Usuario
           
<div class="row">
    <h2>Administración de Usuarios</h2>
    <h3>Crea, Elimina o Actualiza los usuarios de LAPI...</h3>
</div>
<hr />

<div class="row">
<div id="msg" class="span5"></div> 
</div>

<div class="marketing">
    <div class="row">
        @using (Ajax.BeginForm(
            actionName: "Crear",
            controllerName: "Usuario",
            routeValues: null,
            ajaxOptions: new AjaxOptions { HttpMethod = "Post" /*, InsertionMode = System.Web.Mvc.Ajax.InsertionMode.InsertBefore, UpdateTargetId = "alerts"*/, OnFailure = "PostFailure", OnSuccess = "PostSuccess", OnComplete = "PostOnComplete" },
            htmlAttributes: new Dictionary<string, object> { { "class", "form-horizontal" } }
        ))
        {          
             
             <div class="control-group">
                @LAPI.Web.Helpers.LabelExtensions.LabelFor(this.Html, m => m.Nombre, new Dictionary<string, object> { { "class", "control-label" } })
                <div class="controls">
                    @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.Nombre, new Dictionary<string, object> { { "class", "span2" }, { "placeholder", "nombre..." } })
                </div>
            </div>
            
            <div class="control-group">
                @LAPI.Web.Helpers.LabelExtensions.LabelFor(this.Html, m => m.Apellido, new Dictionary<string, object> { { "class", "control-label" } })
                <div class="controls">
                    @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.Apellido, new Dictionary<string, object> { { "class", "span2" }, { "placeholder", "primer apellido..." } })
                    @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.Apellido2, new Dictionary<string, object> { { "class", "span2" }, { "placeholder", "segundo apellido..." } })
                </div>
            </div>

            <div class="control-group">
                @LAPI.Web.Helpers.LabelExtensions.LabelFor(this.Html, m => m.DNI, new Dictionary<string, object> { { "class", "control-label" } })
                <div class="controls">
                    @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.DNI, new Dictionary<string, object> { { "class", "span2" }, { "maxlength", "9" }, { "placeholder", "12345678X..." } })
                </div>
            </div>
            
            <div class="control-group">
                @LAPI.Web.Helpers.LabelExtensions.LabelFor(this.Html, m => m.User, new Dictionary<string, object> { { "class", "control-label" } })
                <div class="controls">
                    @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.User, new Dictionary<string, object> { { "class", "span3" }, { "placeholder", "introduzca un nombre de usuario..." } })                    
                </div>
            </div>           
            
             <div class="control-group">
                @LAPI.Web.Helpers.LabelExtensions.LabelFor(this.Html, m => m.Password, new Dictionary<string, object> { { "class", "control-label" } })
                <div class="controls">
                    @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.Password, new Dictionary<string, object> { { "class", "span3" }, { "placeholder", "introduzca una contraseña..." } })
                </div>
            </div>
            
             <div class="control-group">
                @LAPI.Web.Helpers.LabelExtensions.LabelFor(this.Html, m => m.ConfirmPassword, new Dictionary<string, object> { { "class", "control-label" } })
                <div class="controls">
                    @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.ConfirmPassword, new Dictionary<string, object> { { "class", "span3" }, { "placeholder", "introduzca la misma contraseña..." } })
                </div>
            </div>
            
            <div class="control-group">
                @LAPI.Web.Helpers.LabelExtensions.LabelFor(this.Html, m => m.Email, new Dictionary<string, object> { { "class", "control-label" } })
                <div class="controls">
                    @LAPI.Web.Helpers.TextBoxExtension.TextBoxFor(this.Html, m => m.Email, new Dictionary<string, object> { { "class", "span3" }, { "placeholder", "usuario@domino.es..." } })
                </div>
            </div>    

            <div class="control-group">
                <div class="controls">
                    <button type="submit" class="btn btn-success">
                        <i class="icon-ok"></i>
                        Crear
                    </button>
                    <a class="btn btn-danger" href="@Url.Action(actionName: "Gestion", controllerName: "Usuario")">
                        <i class="icon-remove"></i>
                        Cancelar
                    </a> 
                </div> 
            </div>                             
        }                        
    </div>
</div>

@section Script {   
<script type="text/javascript">
    document.forms[0].Nombre.focus();
</script>
}
